﻿
Imports sonicERPDAL
Imports sonicERPinfo
Imports System.Data.SqlTypes

Public Class ucGRID
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            getnivelusuario()

        End If
    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
        Dim txt As TextBox
        txt = GridView1.BottomPagerRow.FindControl("txtPagina")
        If txt.Text = GridView1.PageIndex + 1 Then
            'O usuário pode ter alterado a caixa
            'superior ou inferior
            txt = GridView1.TopPagerRow.FindControl("txtPagina")
        End If
        GridView1.PageIndex = txt.Text - 1
        GridView1.DataBind()
    End Sub
    Public Sub getnivelusuario()
        Try
            Dim modelo As New NivelUsuarioInfo
            Dim DAL As New nivelUsuarioDAL


            modelo.nivel = Convert.ToString(DBNull.Value)

            modelo.dtinicio = SqlDateTime.MinValue.Value
            modelo.dt_fim = SqlDateTime.MaxValue.Value

            Dim s As String = "teste"
            s.Substring(0, 0)

            GridView1.DataSource = DAL.lista(modelo)
            GridView1.DataBind()

        Catch ex As Exception


        End Try





    End Sub
   
    Private Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        e.Cancel = True
        GridView1.PageIndex = e.NewPageIndex
        getnivelusuario()

    End Sub
End Class